//
//  XQEmergencyCell.m
//  JoinPeso
//
//  Created by 小琦 on 2024/11/26.
//

#import "XQEmergencyCell.h"
#import "XQEmergencyCustomView.h"

@interface XQEmergencyCell()
@property (nonatomic,strong) UIView *bgView;
@end

@implementation XQEmergencyCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = kCardColor;
        [self makeUI];
        [self makeConstraints];
    }
    return self;
}

- (void)makeUI {
    [self.contentView addSubview:self.bgView];
    [self.bgView addSubview:self.contactView];
    [self.bgView addSubview:self.phoneView];
}

- (void)makeConstraints {
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@0);
        make.left.equalTo(@12);
        make.right.equalTo(@-12);
        make.bottom.equalTo(@0);
    }];
    [self.contactView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@0);
        make.right.equalTo(@0);
        make.top.equalTo(@20);
    }];
    [self.phoneView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.equalTo(@0);
        make.top.equalTo(self.contactView.mas_bottom).offset(20);
    }];
}

#pragma mark - lazy

- (UIView *)bgView {
    if (!_bgView) {
        _bgView = [[UIView alloc] init];
        _bgView.backgroundColor = [UIColor whiteColor];
        _bgView.layer.cornerRadius = 15;
        _bgView.layer.masksToBounds = YES;
    }
    return _bgView;
}

- (XQEmergencyCustomView *)contactView {
    if (!_contactView) {
        _contactView = [[XQEmergencyCustomView alloc] init];
        [_contactView setArrowName:@"identity_info_arrow"];
    }
    return _contactView;
}

- (XQEmergencyCustomView *)phoneView {
    if (!_phoneView) {
        _phoneView = [[XQEmergencyCustomView alloc] init];
        [_phoneView setArrowName:@"identity_contact_arrow"];
    }
    return _phoneView;
}


@end
